#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    // 创建一个 std::vector<NoteT> 实例并填充数据


    NoteT file1,tfile;
    file1.name = "file1";
    file1.backGroundColor = "#FFFFFF";
    file1.content = "This is content 1";
    file1.fontColor = "#000000";
    file1.priority = "red";
    file1.site ="2023-01";
    QHash<QString, NoteT> notes;

    // 填充 notes...
    notes.insert("file1.txt",file1);
    Tstruct *tt =new Tstruct;
    // 保存 notes 到文件
    //tt->saveHashToFile("notes.json", notes);

    // 从文件加载 notes
    tt->loadHashFromFile(notes,tfile,"notes.json");

    qDebug()<<"Qhash :"<< notes.value("file1.txt").name;
    qDebug()<<"Qhash :"<< notes.value("test").name;
}

MainWindow::~MainWindow()
{
    delete ui;
}
